﻿using System;
using System.Collections.Generic;
using Color = System.Drawing.Color;
using SwinGame;

namespace Jumpman.src
{
    public class StageLoader
    {
       private List<IDrawable> listOfNextDrawables = new List<IDrawable>();
       private List<GameElement> listOfNextElements = new List<GameElement>();
       private List<IUpdatable> listOfNextUpdatables = new List<IUpdatable>();
       private List<Blocks> listOfNextBlocks = new List<Blocks>();


       private Bitmap nextBackgroundImage;
       private Music nextBackGroundMusic;
      // private Map nextStageMap;

       public void AddBlocks(Blocks b)
       {
           listOfNextBlocks.Add(b);
       }

       public void SetBackGroundMusic(Music bgm)
       {
           nextBackGroundMusic = bgm;
       }

       public void SetBackgroundImage(Bitmap bmp)
       {
           nextBackgroundImage = bmp;
       }

       public void CreateStage(GameController gc)
        {
            
            Stage nextStage = new Stage();
            nextStage.BackgroundImage = nextBackgroundImage;
            nextStage.BackgroundMusic = nextBackGroundMusic;
            //nextStage.StageMap = nextStageMap;
            foreach (IDrawable d in listOfNextDrawables)
            {
                nextStage.ListOfDrawable.Add(d);
            }

            foreach (GameElement gE in listOfNextElements)
            {
                nextStage.ListOfGameElements.Add(gE);
            }

            foreach (IUpdatable u in listOfNextUpdatables)
            {
                nextStage.ListofUpdatables.Add(u);
            }
           
           nextStage.ListOfBlocks = listOfNextBlocks;

            gc.CurrentStage = nextStage;
           
            
        }

        public void AddDrawable(IDrawable d)
        {
            listOfNextDrawables.Add(d);
        }

        public void AddElement(GameElement gE)
        {
            listOfNextElements.Add(gE);
        }

        public void AddUpdatable(IUpdatable u)
        {
            listOfNextUpdatables.Add(u);
        }

        public void ClearAll()
        {
            listOfNextDrawables.Clear();
            listOfNextUpdatables.Clear();
            listOfNextElements.Clear();
            listOfNextBlocks.Clear();
        }



    }
}
